package tech.mhuang.ext.elasticsearch.springboot.sample;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import tech.mhuang.ext.elasticsearch.admin.external.IESExternal;
import tech.mhuang.ext.elasticsearch.admin.factory.IESFactory;
import tech.mhuang.ext.elasticsearch.server.ESFactory;

/**
 *
 * jwt测试
 *
 * @author mhuang
 * @since 1.0.0
 */
@SpringBootApplication
public class ESSampleApplication {

    /**
     * 自定义ES创建类
     * @return
     */
    static class CustomESExternal implements IESExternal {
        @Override
        public IESFactory create(String key) {
            System.out.println("自定义ES生产key"+key);
            return new ESFactory();
        }
    }

    /**
     * 自定义ES
     * @return
     */
    @Bean
    public IESExternal CustomESExternal(){
        return new CustomESExternal();
    }

    public static void main(String[] args) {
        SpringApplication.run(ESSampleApplication.class,args);
    }
}
